package com.heima.freemarker.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
 * @author itheima
 * @since 2022-07-04
 */
@Controller
public class HelloController {

    @GetMapping("/hello")
    public String hello(Model model) {
        model.addAttribute("name","李云龙");
        HashMap<String, Object> map = new HashMap<>();
        map.put("name","李云龙");
        map.put("age",23);
        model.addAttribute("stu",map);

        List<Map<String, Object>> list = new ArrayList<>();
        list.add(map);
        model.addAttribute("stus",list);

        model.addAttribute("date",new Date());
        return "01-basic";
    }

}
